<template>
	<view class="content">
		<view class="info">
			<view class="item">
				<text><text class="require">*</text>所属银行:</text>
				<input type="text" class="ipt" v-model="info.bank_name" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>开户银行:</text>
				<input type="text" class="ipt" v-model="info.deposit_bank" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>银行账号:</text>
				<input type="number" class="ipt" v-model="info.bank_account" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>银行代码:</text>
				<input type="text" class="ipt" v-model="info.swift_code" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>开户地址:</text>
				<input type="text" class="ipt" v-model="info.open_account_address" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>开户电话:</text>
				<input type="text" class="ipt" v-model="info.open_account_phone" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>银行账户辅助核算项编码:</text>
				<input type="text" class="ipt" v-model="info.bank_check_type_code" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>银行账户辅助核算值编码:</text>
				<input type="text" class="ipt" v-model="info.bank_check_type_value" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>开户地址辅助核算项编码:</text>
				<input type="text" class="ipt" v-model="info.address_check_type_code" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
			<view class="item">
				<text><text class="require">*</text>开户地址辅助核算值编码:</text>
				<input type="text" class="ipt" v-model="info.address_check_type_value" placeholder="请输入"
					placeholder-class="input-style" />
			</view>
		</view>
		<view class="fixedbtn">
			<view class="btnbox">
				<view class="btn" @tap="submit">保存</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		bankDetail,setBankInfo
	} from '../../../network/main.js';
	import {
		onShow,
	} from '@dcloudio/uni-app';
	import {
		ref,
		reactive
	} from 'vue';
	const info = reactive({
		bank_name:'',
		deposit_bank:'',
		bank_account:'',
		swift_code:'',
		open_account_address:'',
		open_account_phone:'',
		bank_check_type_code:'',
		bank_check_type_value:'',
		address_check_type_code:'',
		address_check_type_value:''
	})
	onShow(()=>{
		getDetail()
	})
	const getDetail = ()=>{
		bankDetail().then(res=>{
			if(res.data.data){
				Object.assign(info, res.data.data)
			}
		})
	}
	const submit = ()=>{
		setBankInfo(info).then(res=>{
			uni.showToast({
				title: '保存成功'
			})
			setTimeout(()=>{
				uni.navigateBack({
					delta:1
				})
			},300)
		})
	}
</script>

<style lang="scss">
	.content {
		padding-bottom: 200rpx;
		padding-top: 20rpx;

		.info {
			background-color: #fff;

			.item {
				width: 100%;
				height: 100rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 28rpx;
				padding:  0 40rpx;
				box-sizing: border-box;
				border-top: 2rpx solid #f7f7f7;

				.ipt {
					text-align: right;
					font-size: 28rpx;
				}
			}
		}

		.fixedbtn {
			width: 100%;
			border-top: 2rpx solid #f7f7f7;
			position: fixed;
			bottom: 0;
			left: 0;
			padding: 30rpx 0;
			background-color: #fff;
			z-index: 99;
		
			.btnbox {
				width: 100%;
				display: flex;
				justify-content: space-around;
		
				.btn {
					width: 400rpx;
					height: 70rpx;
					background-color: #ffc400;
					line-height: 70rpx;
					text-align: center;
					border-radius: 12rpx;
					font-size: 26rpx;
				}
			}
		}
	}
</style>